from waveapi import events
from waveapi import model
from waveapi import robot
import time

def OnSelfAdded(properties, context):
  """Invoked when the robot is added to a wave."""
  Notify(context)


def Notify(context):
  root_wavelet = context.GetRootWavelet()
  for i in range(5):
	root_wavelet.CreateBlip().GetDocument().SetText("New Message!")
	time.sleep(10)

if __name__ == '__main__':
  myRobot = robot.Robot('pingy', 
      image_url='http://pingy-wave.prom.corp.google.com/assets/icon.png',
      version='1',
      profile_url='http://pingy-wave.prom.corp.google.com/')
  myRobot.RegisterHandler(events.WAVELET_SELF_ADDED, OnSelfAdded)
  myRobot.Run()
